<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateReviewFeedbackTable extends AbstractMigration
{
    public function up()
    {
        $table = $this->table('review_feedback', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '审核反馈']);
        $table->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '主键ID'])
            ->addColumn('title', 'string', ['default' => '', 'limit' => 128, 'comment' => '标题'])
            ->addColumn('project_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '项目ID'])
            ->addColumn('episode_codes', 'text', ['null' => true, 'comment' => '集codes'])
            ->addColumn('module_code', 'enum', ['values' => 'asset,shot', 'default' => 'asset', 'comment' => '关联模块 (asset 资产 shot 镜头)'])
            ->addColumn('status', 'enum', ['values' => 'not_started,in_progress,final', 'default' => 'not_started', 'comment' => '状态: not_started 未开始,in_progress  进行中,final 已完成'])
            ->addColumn('json', 'json', ['null' => true, 'comment' => 'json字段，存储自定义字段'])
            ->addColumn('step_category_ids', 'text', ['null' => true, 'comment' => '环节ids'])
            ->addColumn('created_by', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建者'])
            ->addColumn('created', 'integer', ['null' => false, 'default' => 0, 'limit' => 11, 'signed' => false, 'comment' => '创建时间',])
            ->save();
    }

    public function down()
    {
        $this->table('review_feedback')->drop()->save();
    }
}
